﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PalFramework.Template;

namespace PalBattleEmulator.Template.Effect
{
    public class MagicEffectTmpl : PalObjectTmpl, IMagicEffectTmpl
    {
        public override void LoadData(Dictionary<string, string> data)
        {
            foreach (string key in data.Keys)
            {
                if (dictionary.ContainsKey(key))
                {
                    int type = dictionary[key];
                    string value = data[key];
                    switch (type)
                    {
                        case ID:
                            Id = Convert.ToInt32(value);
                            break;
                        case NAME:
                            Name = value;
                            break;
                        case IMAGE_INDEX:
                            imageIndex = value;
                            break;
                        case DRAW_TYPE:
                            drawType = Convert.ToInt32(value);
                            break;
                        case X_REVISE:
                            xRevise = Convert.ToInt32(value);
                            break;
                        case Y_REVISE:
                            yRevise = Convert.ToInt32(value);
                            break;
                        case Z_INDEX:
                            zIndex = Convert.ToInt32(value);
                            break;
                        case SPEED:
                            speed = Convert.ToInt32(value);
                            break;
                        case REMAINS:
                            remains = Convert.ToInt32(value);
                            break;
                        case DELAY:
                            delay = Convert.ToInt32(value);
                            break;
                        case TIMES:
                            times = Convert.ToInt32(value);
                            break;
                    }
                }

            }
        }

        private string imageIndex;

        public string ImageIndex
        {
            get { return imageIndex; }
            set { imageIndex = value; }
        }

        private int drawType;

        public int DrawType
        {
            get { return drawType; }
            set { drawType = value; }
        }

        private int xRevise;

        public int XRevise
        {
            get { return xRevise; }
            set { xRevise = value; }
        }

        private int yRevise;

        public int YRevise
        {
            get { return yRevise; }
            set { yRevise = value; }
        }

        private int zIndex;

        public int ZIndex
        {
            get { return zIndex; }
            set { zIndex = value; }
        }

        private int speed;

        public int Speed
        {
            get { return speed; }
            set { speed = value; }
        }

        private int remains;

        public int Remains
        {
            get { return remains; }
            set { remains = value; }
        }

        private int delay;

        public int Delay
        {
            get { return delay; }
            set { delay = value; }
        }

        private int times;

        public int Times
        {
            get { return times; }
            set { times = value; }
        }

        public const int ID = 0;
        public const int NAME = 1;
        public const int IMAGE_INDEX = 3;
        public const int DRAW_TYPE = 4;
        public const int X_REVISE = 5;
        public const int Y_REVISE = 6;
        public const int Z_INDEX = 7;
        public const int SPEED = 8;
        public const int REMAINS = 9;
        public const int DELAY = 10;
        public const int TIMES = 11;
        public const int SHAKE = 12;
        public const int WAVE = 13;

        private static Dictionary<string, int> dictionary;

        static MagicEffectTmpl()
        {
            dictionary = new Dictionary<string, int>();
            dictionary.Add("id", ID);
            dictionary.Add("name", NAME);
            dictionary.Add("image_index", IMAGE_INDEX);
            dictionary.Add("draw_type", DRAW_TYPE);
            dictionary.Add("x_revise", X_REVISE);
            dictionary.Add("y_revise", Y_REVISE);
            dictionary.Add("z_index", Z_INDEX);
            dictionary.Add("speed", SPEED);
            dictionary.Add("remains", REMAINS);
            dictionary.Add("delay", DELAY);
            dictionary.Add("times", TIMES);
            dictionary.Add("shake", SHAKE);
            dictionary.Add("wave", WAVE);
        }
    }
}
